<!--
 * @Descripttion: 使用正则的方式-字符串方法介绍
 * @Author: YuZhenJing
 * @Date: 2020-06-26 17:53:40
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-06-27 08:34:47
-->
<!DOCTYPE html>
<html lang="zh_CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>字符串方法介绍</title>
  </head>
  <body>
    <script>
      let title_style = "font-weight: bold;color:red;";
      let test_style = "padding-left:20px;color:yellow;";
      console.log("%c字符串正则相关方法：", title_style);
      console.log("%cmatch:", test_style, "anyun666".match(/\d+/));
      for (let interator of "anyun666".matchAll(/\d/g)) {
        console.log("%cmatchAll:", test_style, interator);
      }
      console.log("%cmatchAll必须与/../g全局匹配配合使用", test_style);
      console.log(
        "%creplace:",
        test_style,
        "anyun666".replace(/\d+/, "-cangge")
      );
      console.log("%csplit:", test_style, "2020/06/26".split(/[-/]/));
      console.log("%csearch:", test_style, "anyun666".search(/\d/));
    </script>
  </body>
</html>
